package com.baby.security.impl;

import com.baby.security.model.User;
import com.baby.security.dao.UserMapper;
import com.baby.security.pojo.UserInfoDO;
import com.baby.security.service.UserService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ${author}
 * @since 2022-06-17
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Resource
    private UserMapper userService;

    /**
     * 更加用户名获取信息
     *
     * @param username
     * @return
     */
    @Override
    public User getUserByName(String username) {
        User user = userService.selectOne(new LambdaQueryWrapper<User>()
                .eq(User::getUserName, username));
        return user;
    }

    @Override
    public UserInfoDO getUserInfoByName(String username) {
        return userService.getUserInfoByUserName(username);
    }
}
